#include<iostream>
#include<cstdio>
using namespace std;
int n,q;
int a[8005];
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin>>n>>q;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=q;i++){
		int t;
		cin>>t;
		if(t==1){
			int x,v;
			cin>>x>>v;
			a[x]=v;
		}else{
			int x;
			cin>>x;
			int cnt=0;
			for(int i=1;i<=n;i++){
				if(a[i]<a[x]||(a[i]==a[x]&&i<x)){
					cnt++;
				}
			}
			cout<<cnt+1<<endl;
		}
	}
	return 0;
}
